<include file="Public/header" />
<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <h3>外链管理</h3>
      <ul class="tab-base">
         <li><a href="{:U('Setting/links')}"><span>管理</span></a></li>
        <li><a href="JavaScript:void(0);" class="current"><span>添加</span></a></li>
      </ul>
    </div>
  </div>
  <div class="fixed-empty"></div>
  <form id="add_form" method="post" action="{:U('')}" enctype="multipart/form-data" >
      <input type="hidden" name="link_id" value="{$info['link_id']}" />
    <table class="table tb-type2 nobdb">
      <tbody>
        <tr class="noborder">
          <td colspan="2" class="required"><label class="validation" for="link_name">链接名称:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" id="link_name" name="link_name" value="{$info['link_name']}" class="txt"></td>
          <td class="vatop tips"></td>
        </tr>

        <tr class="noborder">
            <td colspan="2" class="required"><label class="validation" for="link_url">链接地址:</label></td>
        </tr>
        <tr class="noborder">
            <td class="vatop rowform"><input type="text" id="link_url" name="link_url" value="{$info['link_url']}" class="txt"></td>
            <td class="vatop tips"></td>
        </tr>

        <tr class="noborder">
            <td colspan="2" class="required"><label class="validation" for="link_target">打开方式:</label></td>
        </tr>
        <tr class="noborder">
            <td class="vatop rowform">
                <select id="link_target" name="link_target">
                    <option value="_blank" <if condition="$info['link_target'] eq '_blank'">selected</if> >新窗口</option>
                    <option value="_self"  <if condition="$info['link_target'] eq '_self'">selected</if> >当前窗口</option>
                </select>
            </td>
            <td class="vatop tips"></td>
        </tr>

        <tr>
            <td colspan="2" class="required"><label for="link_image">链接图片:</label></td>
        </tr>
        <tr class="noborder">
            <td class="vatop rowform">
          	<span class="type-file-show">
          		<img class="show_image" src="__IMG__/preview.png">
            	<div class="type-file-preview"><img src="__UPLOADS__{$info['link_image']}"></div>
            </span>
            <span class="type-file-box">
            <input type='text' name='txt_link_image' id='txt_link_image' class='type-file-text' />
            <input type='button' name='but_link_image' id='but_link_image' value='' class='type-file-button' />
            <input name="link_image" type="file" class="type-file-file" id="link_image" size="30" hidefocus="true" nc_type="change_site_logo">
            </span>
            </td>
            <td class="vatop tips"><span class="vatop rowform"></span></td>
        </tr>

         <tr class="noborder">
          <td colspan="2" class="required"><label class="validation" for="link_sort">排序:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" id="link_sort" name="link_sort" value="{$info['link_sort']}" class="txt"></td>
          <td class="vatop tips"></td>
        </tr>

        <tr>
            <td colspan="2" class="required"><label for="link_description">链接描述:</label></td>
        </tr>
        <tr class="noborder">
            <td class="vatop rowform"><textarea name="link_description" rows="6" class="tarea" id="link_description">{$info['link_description']}</textarea></td>
            <td class="vatop tips"><span class="vatop rowform"></span></td>
        </tr>

      </tbody>
      <tfoot>
        <tr class="tfoot">
          <td colspan="2"><a href="JavaScript:void(0);" class="btn" id="submitBtn"><span>保存</span></a></td>
        </tr>
      </tfoot>
    </table>
  </form>
</div>
<script>
//按钮先执行验证再提交表
$(function(){$("#submitBtn").click(function(){
    if($("#add_form").valid()){
     $("#add_form").submit();
	}
	});
});
$("#link_image").change(function(){
    $("#txt_link_image").val($(this).val());
});
</script> 
<include file="Public/footer" />